/**
 *
 */
package com.mmlc.meimei.lichengkongjian.mine;

import com.androidnetframe.BaseParentActivity;
import com.androidnetframe.httputil.BaseRequestFilterLayer;
import com.androidnetframe.httputil.EntryPageName;
import com.mmlc.businessutils.OrderListUtils;
import com.mmlc.meimei.lichengkongjian.been.ListItemBeanNew;
import com.mmlc.network.requestbean.OrderDetailRequestBean;
import com.mmlc.network.responsebean.OrderDetailResponseBean;

import java.util.List;

/**
 * @author 何强
 *         2015-12-18
 * @修改 张园汀 2015-12-30
 */
public class OrderDetailFilter extends BaseRequestFilterLayer {
    public OrderDetailRequestBean requestBean = new OrderDetailRequestBean();

    public OrderDetailFilter(BaseParentActivity context) {
        super(context);
        makeRequestParams.entryPageName = EntryPageName.n5_a + "";
        makeRequestParams.setReqeustBean(requestBean, true);
    }

    public ListItemBeanNew responseBean ;
    @Override
    public void getResultSuccess(String responseString, Object obj){
        OrderDetailResponseBean data = (OrderDetailResponseBean) obj;

        OrderDetailResponseBean.DataBean bean0 = data.getData();

        responseBean = new ListItemBeanNew();
        responseBean.orderNumber = bean0.getId();
        responseBean.orderState = bean0.getStatus_msg();
        responseBean.allShopPrice = bean0.getOrder_price();
        responseBean.payCode = bean0.getPay_code();
        responseBean.outButtonType = OrderListUtils.getOper(bean0.getOper());

        for(int i = 0; i<data.getData().getOrder_goods().size();i++){
            OrderDetailResponseBean.DataBean.OrderGoodsBean bean1 = data.getData().getOrder_goods().get(i);
            String imgUrl = bean1.getImg_thumb_min();
            String firstTitle = bean1.getGoods_name();
            String secondTitle = bean1.getSpec_name();
            String shopPrice = bean1.getPrice();
            String shopCount = bean1.getNum();
            String goodsId = bean1.getGoods_id();
            String id = bean1.getId();
            List<Integer> inButtonType = OrderListUtils.getOper(bean1.getOper());

            responseBean.putItemBean(imgUrl,firstTitle,secondTitle,shopPrice,shopCount,goodsId,id,inButtonType);
        }
    }

}
